package com.liyong.pullorder.channels.auth;

import org.springframework.http.HttpHeaders;

import java.util.Map;

public class OAuth2AuthStrategy implements AuthStrategy {
    @Override
    public String getType() { return "OAUTH2"; }

    @Override
    public void apply(HttpHeaders headers, Map<String, String> config) {
        String token = config.get("accessToken");
        if (token != null) {
            headers.add(HttpHeaders.AUTHORIZATION, "Bearer " + token);
        }
    }
}